{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\"TALENT_Abyss Lector: Fathomless Flames/Embers Rekindled\": \"烬火重燃\",\n",
      "\"TALENT_Albedo/Descent of Divinity\": \"神性之陨\",\n",
      "\"TALENT_Amber/Bunny Triggered\": \"一触即发\",\n",
      "\"TALENT_Arataki Itto/Arataki Ichiban\": \"荒泷第一\",\n",
      "\"TALENT_Barbara/Glorious Season\": \"光辉的季节\",\n",
      "\"TALENT_Beidou/Lightning Storm\": \"霹雳连霄\",\n",
      "\"TALENT_Bennett/Grand Expectation\": \"冒险憧憬\",\n",
      "\"TALENT_Candace/The Overflow\": \"衍溢的汐潮\",\n",
      "\"TALENT_Chongyun/Steady Breathing\": \"吐纳真定\",\n",
      "\"TALENT_Collei/Floral Sidewinder\": \"飞叶迴斜\",\n",
      "\"TALENT_Cyno/Featherfall Judgment\": \"落羽的裁择\",\n",
      "\"TALENT_Dehya/Stalwart and True\": \"崇诚之真\",\n",
      "\"TALENT_Diluc/Flowing Flame\": \"流火焦灼\",\n",
      "\"TALENT_Diona/Shaken, Not Purred\": \"猫爪冰摇\",\n",
      "\"TALENT_Electro Hypostasis/Absorbing Prism\": \"汲能棱晶\",\n",
      "\"TALENT_Eula/Wellspring of War-Lust\": \"战欲涌现\",\n",
      "\"TALENT_Fatui Cryo Cicin Mage/Cicin's Cold Glare\": \"冰萤寒光\",\n",
      "\"TALENT_Fatui Pyro Agent/Paid in Full\": \"悉数讨回\",\n",
      "\"TALENT_Fischl/Stellar Predator\": \"噬星魔鸦\",\n",
      "\"TALENT_Ganyu/Undivided Heart\": \"唯此一心\",\n",
      "\"TALENT_Hu Tao/Sanguine Rouge\": \"血之灶火\",\n",
      "\"TALENT_Jadeplume Terrorshroom/Proliferating Spores\": \"孢子增殖\",\n",
      "\"TALENT_Jean/Lands of Dandelion\": \"蒲公英的国土\",\n",
      "\"TALENT_Kaedehara Kazuha/Poetics of Fuubutsu\": \"风物之诗咏\",\n",
      "\"TALENT_Kaeya/Cold-Blooded Strike\": \"冷血之剑\",\n",
      "\"TALENT_Kamisato Ayaka/Kanten Senmyou Blessing\": \"寒天宣命祝词\",\n",
      "\"TALENT_Kamisato Ayato/Kyouka Fuushi\": \"镜华风姿\",\n",
      "\"TALENT_Keqing/Lightning Stiletto\": \"抵天雷罚\",\n",
      "\"TALENT_Keqing/Thundering Penance\": \"抵天雷罚\",\n",
      "\"TALENT_Klee/Pounding Surprise\": \"砰砰礼物\",\n",
      "\"TALENT_Kujou Sara/Sin of Pride\": \"我界\",\n",
      "\"TALENT_Lisa/Pulsating Witch\": \"脉冲的魔女\",\n",
      "\"TALENT_Maguu Kenki/Transcendent Automaton\": \"机巧神通\",\n",
      "\"TALENT_Mirror Maiden/Mirror Cage\": \"镜锢之笼\",\n",
      "\"TALENT_Mona/Prophecy of Submersion\": \"沉没的预言\",\n",
      "\"TALENT_Nahida/The Seed of Stored Knowledge\": \"心识蕴藏之种\",\n",
      "\"TALENT_Ningguang/Strategic Reserve\": \"储之千日，用之一刻\",\n",
      "\"TALENT_Noelle/I Got Your Back\": \"支援就交给我吧\",\n",
      "\"TALENT_Qiqi/Rite of Resurrection\": \"起死回骸\",\n",
      "\"TALENT_Raiden Shogun/Wishes Unnumbered\": \"万千的愿望\",\n",
      "\"TALENT_Razor/Awakening\": \"觉醒\",\n",
      "\"TALENT_Rhodeia of Loch/Streaming Surge\": \"百川奔流\",\n",
      "\"TALENT_Sangonomiya Kokomi/Tamakushi Casket\": \"匣中玉栉\",\n",
      "\"TALENT_Shenhe/Mystical Abandon\": \"忘玄\",\n",
      "\"TALENT_Stonehide Lawachurl/Stonehide Reforged\": \"重铸：岩盔\",\n",
      "\"TALENT_Sucrose/Chaotic Entropy\": \"混元熵增论\",\n",
      "\"TALENT_Tartaglia/Abyssal Mayhem: Hydrospout\": \"深渊之灾·凝水盛放\",\n",
      "\"TALENT_Tighnari/Keen Sight\": \"眼识殊明\",\n",
      "\"TALENT_Venti/Embrace of Winds\": \"绪风之拥\",\n",
      "\"TALENT_Wanderer/Gales of Reverie\": \"梦迹一风\",\n",
      "\"TALENT_Xiangling/Crossfire\": \"交叉火力\",\n",
      "\"TALENT_Xiao/Conqueror of Evil: Guardian Yaksha\": \"降魔·护法夜叉\",\n",
      "\"TALENT_Xingqiu/The Scent Remained\": \"重帘留香\",\n",
      "\"TALENT_Yae Miko/The Shrine's Sacred Shade\": \"神篱之御荫\",\n",
      "\"TALENT_Yanfei/Right of Final Interpretation\": \"最终解释权\",\n",
      "\"TALENT_Yaoyao/Beneficent\": \"慈惠仁心\",\n",
      "\"TALENT_Yoimiya/Naganohara Meteor Swarm\": \"长野原龙势流星群\",\n",
      "\"TALENT_Zhongli/Dominance of Earth\": \"炊金馔玉\",\n"
     ]
    }
   ],
   "source": [
    "# fill team status and character status names that same as card or weapon names\n",
    "import json\n",
    "data = json.load(open('eng_names.json'))\n",
    "for key in data.keys():\n",
    "    if 'TEAM_STATUS/' in key:  # also character status\n",
    "        real_name = key.split('/')[-1]\n",
    "        for key2, v in data.items():\n",
    "            if real_name in key2 and v != '':\n",
    "                data[key] = v\n",
    "                break\n",
    "        print(f'\"{key}\": \"{data[key]}\",')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# fill talent names\n",
    "import json\n",
    "data = json.load(open('eng_names.json'))\n",
    "chn_data = json.load(open('chn_card.json'))\n",
    "for key in data.keys():\n",
    "    if 'TALENT_' in key:\n",
    "        char_name = key.split('/')[0].split('_')[-1]\n",
    "        real_name = key.split('/')[-1]\n",
    "        char_chn_name = data[f'CHARACTER/{char_name}']\n",
    "        chn_name = ''\n",
    "        for chn_key in chn_data.keys():\n",
    "            if char_chn_name in chn_data[chn_key]:\n",
    "                assert chn_name == ''\n",
    "                chn_name = chn_key\n",
    "        assert chn_name != ''\n",
    "        # print(f'{key} {char_name} {chn_name}')\n",
    "        print(f'\"{key}\": \"{chn_name}\",')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\"SKILL_Abyss Lector: Fathomless Flames_ELEMENTAL_BURST/Ominous Star\": \"天陨预兆\",\n",
      "\"SKILL_Abyss Lector: Fathomless Flames_ELEMENTAL_SKILL/Searing Precept\": \"炽烈箴言\",\n",
      "\"SKILL_Abyss Lector: Fathomless Flames_NORMAL_ATTACK/Flame of Salvation\": \"拯救之焰\",\n",
      "\"SKILL_Abyss Lector: Fathomless Flames_PASSIVE/Fiery Rebirth\": \"火之新生\",\n",
      "\"SKILL_Albedo_ELEMENTAL_BURST/Rite of Progeniture: Tectonic Tide\": \"诞生式·大地之潮\",\n",
      "\"SKILL_Albedo_ELEMENTAL_SKILL/Abiogenesis: Solar Isotoma\": \"创生法·拟造阳华\",\n",
      "\"SKILL_Albedo_NORMAL_ATTACK/Favonius Bladework - Weiss\": \"西风剑术·白\",\n",
      "\"SKILL_Amber_ELEMENTAL_BURST/Fiery Rain\": \"箭雨\",\n",
      "\"SKILL_Amber_ELEMENTAL_SKILL/Explosive Puppet\": \"爆弹玩偶\",\n",
      "\"SKILL_Amber_NORMAL_ATTACK/Sharpshooter\": \"神射手\",\n",
      "\"SKILL_Arataki Itto_ELEMENTAL_BURST/Royal Descent: Behold, Itto the Evil!\": \"最恶鬼王·一斗轰临！！\",\n",
      "\"SKILL_Arataki Itto_ELEMENTAL_SKILL/Masatsu Zetsugi: Akaushi Burst!\": \"魔杀绝技·赤牛发破！\",\n",
      "\"SKILL_Arataki Itto_NORMAL_ATTACK/Fight Club Legend\": \"喧哗屋传说\",\n",
      "\"SKILL_Barbara_ELEMENTAL_BURST/Shining Miracle\": \"闪耀奇迹♪\",\n",
      "\"SKILL_Barbara_ELEMENTAL_SKILL/Let the Show Begin♪\": \"演唱，开始♪\",\n",
      "\"SKILL_Barbara_NORMAL_ATTACK/Whisper of Water\": \"水之浅唱\",\n",
      "\"SKILL_Beidou_ELEMENTAL_BURST/Stormbreaker\": \"斫雷\",\n",
      "\"SKILL_Beidou_ELEMENTAL_SKILL/Tidecaller\": \"捉浪\",\n",
      "\"SKILL_Beidou_ELEMENTAL_SKILL/Wavestrider\": \"捉浪\",\n",
      "\"SKILL_Beidou_NORMAL_ATTACK/Oceanborne\": \"征涛\",\n",
      "\"SKILL_Bennett_ELEMENTAL_BURST/Fantastic Voyage\": \"美妙旅程\",\n",
      "\"SKILL_Bennett_ELEMENTAL_SKILL/Passion Overload\": \"热情过载\",\n",
      "\"SKILL_Bennett_NORMAL_ATTACK/Strike of Fortune\": \"好运剑\",\n",
      "\"SKILL_Candace_ELEMENTAL_BURST/Sacred Rite: Wagtail's Tide\": \"圣仪·灰鸰衒潮\",\n",
      "\"SKILL_Candace_ELEMENTAL_SKILL/Heron Strike\": \"圣仪·苍鹭庇卫\",\n",
      "\"SKILL_Candace_ELEMENTAL_SKILL/Sacred Rite: Heron's Sanctum\": \"圣仪·苍鹭庇卫\",\n",
      "\"SKILL_Candace_NORMAL_ATTACK/Gleaming Spear - Guardian Stance\": \"流耀枪术·守势\",\n",
      "\"SKILL_Chongyun_ELEMENTAL_BURST/Cloud-Parting Star\": \"云开星落\",\n",
      "\"SKILL_Chongyun_ELEMENTAL_SKILL/Chonghua's Layered Frost\": \"重华叠霜\",\n",
      "\"SKILL_Chongyun_NORMAL_ATTACK/Demonbane\": \"灭邪四式\",\n",
      "\"SKILL_Collei_ELEMENTAL_BURST/Trump-Card Kitty\": \"猫猫秘宝\",\n",
      "\"SKILL_Collei_ELEMENTAL_SKILL/Floral Brush\": \"拂花偈叶\",\n",
      "\"SKILL_Collei_NORMAL_ATTACK/Supplicant's Bowmanship\": \"祈颂射艺\",\n",
      "\"SKILL_Cyno_ELEMENTAL_BURST/Sacred Rite: Wolf's Swiftness\": \"圣仪·煟煌随狼行\",\n",
      "\"SKILL_Cyno_ELEMENTAL_SKILL/Secret Rite: Chasmic Soulfarer\": \"秘仪·律渊渡魂\",\n",
      "\"SKILL_Cyno_NORMAL_ATTACK/Invoker's Spear\": \"七圣枪术\",\n",
      "\"SKILL_Cyno_PASSIVE/Lawful Enforcer\": \"行度誓惩\",\n",
      "\"SKILL_Dehya_ELEMENTAL_BURST/Incineration Drive\": \"炎啸狮子咬\",\n",
      "\"SKILL_Dehya_ELEMENTAL_BURST/Leonine Bite\": \"炎啸狮子咬\",\n",
      "\"SKILL_Dehya_ELEMENTAL_SKILL/Molten Inferno\": \"熔铁流狱\",\n",
      "\"SKILL_Dehya_NORMAL_ATTACK/Sandstorm Assault\": \"拂金剑斗术\",\n",
      "\"SKILL_Diluc_ELEMENTAL_BURST/Dawn\": \"黎明\",\n",
      "\"SKILL_Diluc_ELEMENTAL_SKILL/Searing Onslaught\": \"逆焰之刃\",\n",
      "\"SKILL_Diluc_NORMAL_ATTACK/Tempered Sword\": \"淬炼之剑\",\n",
      "\"SKILL_Diona_ELEMENTAL_BURST/Signature Mix\": \"最烈特调\",\n",
      "\"SKILL_Diona_ELEMENTAL_SKILL/Icy Paws\": \"猫爪冻冻\",\n",
      "\"SKILL_Diona_NORMAL_ATTACK/Kätzlein Style\": \"猎人射术\",\n",
      "\"SKILL_Electro Hypostasis_ELEMENTAL_BURST/Lightning Lockdown\": \"雳霆镇锁\",\n",
      "\"SKILL_Electro Hypostasis_ELEMENTAL_SKILL/Rock-Paper-Scissors Combo\": \"猜拳三连击\",\n",
      "\"SKILL_Electro Hypostasis_ELEMENTAL_SKILL/Rock-Paper-Scissors Combo: Paper\": \"猜拳三连击\",\n",
      "\"SKILL_Electro Hypostasis_ELEMENTAL_SKILL/Rock-Paper-Scissors Combo: Scissors\": \"猜拳三连击\",\n",
      "\"SKILL_Electro Hypostasis_NORMAL_ATTACK/Electro Crystal Projection\": \"雷晶投射\",\n",
      "\"SKILL_Electro Hypostasis_PASSIVE/Electro Crystal Core\": \"雷晶核心\",\n",
      "\"SKILL_Eula_ELEMENTAL_BURST/Glacial Illumination\": \"凝浪之光剑\",\n",
      "\"SKILL_Eula_ELEMENTAL_SKILL/Icetide Vortex\": \"冰潮的涡旋\",\n",
      "\"SKILL_Eula_NORMAL_ATTACK/Favonius Bladework - Edel\": \"西风剑术·宗室\",\n",
      "\"SKILL_Fatui Cryo Cicin Mage_ELEMENTAL_BURST/Blizzard, Branch, Blossom\": \"冰枝白花\",\n",
      "\"SKILL_Fatui Cryo Cicin Mage_ELEMENTAL_SKILL/Misty Summons\": \"雾虚摇唤\",\n",
      "\"SKILL_Fatui Cryo Cicin Mage_NORMAL_ATTACK/Cicin Icicle\": \"冰萤棱锥\",\n",
      "\"SKILL_Fatui Pyro Agent_ELEMENTAL_BURST/Blade Ablaze\": \"焚毁之锋\",\n",
      "\"SKILL_Fatui Pyro Agent_ELEMENTAL_SKILL/Prowl\": \"伺机而动\",\n",
      "\"SKILL_Fatui Pyro Agent_NORMAL_ATTACK/Thrust\": \"突刺\",\n",
      "\"SKILL_Fatui Pyro Agent_PASSIVE/Stealth Master\": \"潜行大师\",\n",
      "\"SKILL_Fischl_ELEMENTAL_BURST/Midnight Phantasmagoria\": \"至夜幻现\",\n",
      "\"SKILL_Fischl_ELEMENTAL_SKILL/Nightrider\": \"夜巡影翼\",\n",
      "\"SKILL_Fischl_NORMAL_ATTACK/Bolts of Downfall\": \"罪灭之矢\",\n",
      "\"SKILL_Ganyu_ELEMENTAL_BURST/Celestial Shower\": \"降众天华\",\n",
      "\"SKILL_Ganyu_ELEMENTAL_SKILL/Trail of the Qilin\": \"山泽麟迹\",\n",
      "\"SKILL_Ganyu_NORMAL_ATTACK/Frostflake Arrow\": \"\"\n",
      "\"SKILL_Ganyu_NORMAL_ATTACK/Liutian Archery\": \"\"\n",
      "\"SKILL_Hu Tao_ELEMENTAL_BURST/Spirit Soother\": \"安神秘法\",\n",
      "\"SKILL_Hu Tao_ELEMENTAL_SKILL/Guide to Afterlife\": \"蝶引来生\",\n",
      "\"SKILL_Hu Tao_NORMAL_ATTACK/Secret Spear of Wangsheng\": \"往生秘传枪法\",\n",
      "\"SKILL_Jadeplume Terrorshroom_ELEMENTAL_BURST/Feather Spreading\": \"尾羽豪放\",\n",
      "\"SKILL_Jadeplume Terrorshroom_ELEMENTAL_SKILL/Volatile Spore Cloud\": \"不稳定孢子云\",\n",
      "\"SKILL_Jadeplume Terrorshroom_NORMAL_ATTACK/Majestic Dance\": \"菌王舞步\",\n",
      "\"SKILL_Jadeplume Terrorshroom_PASSIVE/Radical Vitality\": \"活化激能\",\n",
      "\"SKILL_Jean_ELEMENTAL_BURST/Dandelion Breeze\": \"蒲公英之风\",\n",
      "\"SKILL_Jean_ELEMENTAL_SKILL/Gale Blade\": \"风压剑\",\n",
      "\"SKILL_Jean_NORMAL_ATTACK/Favonius Bladework\": \"西风剑术\",\n",
      "\"SKILL_Kaedehara Kazuha_ELEMENTAL_BURST/Kazuha Slash\": \"万叶之一刀\",\n",
      "\"SKILL_Kaedehara Kazuha_ELEMENTAL_SKILL/Chihayaburu\": \"千早振\",\n",
      "\"SKILL_Kaedehara Kazuha_NORMAL_ATTACK/Garyuu Bladework\": \"我流剑术\",\n",
      "\"SKILL_Kaeya_ELEMENTAL_BURST/Glacial Waltz\": \"凛冽轮舞\",\n",
      "\"SKILL_Kaeya_ELEMENTAL_SKILL/Frostgnaw\": \"霜袭\",\n",
      "\"SKILL_Kaeya_NORMAL_ATTACK/Ceremonial Bladework\": \"仪典剑术\",\n",
      "\"SKILL_Kamisato Ayaka_ELEMENTAL_BURST/Kamisato Art: Soumetsu\": \"神里流·霜灭\",\n",
      "\"SKILL_Kamisato Ayaka_ELEMENTAL_SKILL/Kamisato Art: Hyouka\": \"神里流·冰华\",\n",
      "\"SKILL_Kamisato Ayaka_NORMAL_ATTACK/Kamisato Art: Kabuki\": \"神里流·倾\",\n",
      "\"SKILL_Kamisato Ayaka_PASSIVE/Kamisato Art: Senho\": \"神里流·霰步\",\n",
      "\"SKILL_Kamisato Ayato_ELEMENTAL_BURST/Kamisato Art: Suiyuu\": \"神里流·水囿\",\n",
      "\"SKILL_Kamisato Ayato_ELEMENTAL_SKILL/Kamisato Art: Kyouka\": \"神里流·镜花\",\n",
      "\"SKILL_Kamisato Ayato_NORMAL_ATTACK/Kamisato Art: Marobashi\": \"神里流·转\",\n",
      "\"SKILL_Keqing_ELEMENTAL_BURST/Starward Sword\": \"天街巡游\",\n",
      "\"SKILL_Keqing_ELEMENTAL_SKILL/Stellar Restoration\": \"星斗归位\",\n",
      "\"SKILL_Keqing_NORMAL_ATTACK/Yunlai Swordsmanship\": \"云来剑法\",\n",
      "\"SKILL_Klee_ELEMENTAL_BURST/Sparks 'n' Splash\": \"轰轰火花\",\n",
      "\"SKILL_Klee_ELEMENTAL_SKILL/Jumpy Dumpty\": \"蹦蹦炸弹\",\n",
      "\"SKILL_Klee_NORMAL_ATTACK/Kaboom!\": \"砰砰\",\n",
      "\"SKILL_Kujou Sara_ELEMENTAL_BURST/Subjugation: Koukou Sendou\": \"煌煌千道镇式\",\n",
      "\"SKILL_Kujou Sara_ELEMENTAL_SKILL/Tengu Stormcall\": \"鸦羽天狗霆雷召咒\",\n",
      "\"SKILL_Kujou Sara_NORMAL_ATTACK/Tengu Bowmanship\": \"天狗传弓术\",\n",
      "\"SKILL_Lisa_ELEMENTAL_BURST/Lightning Rose\": \"蔷薇的雷光\",\n",
      "\"SKILL_Lisa_ELEMENTAL_SKILL/Violet Arc\": \"苍雷\",\n",
      "\"SKILL_Lisa_NORMAL_ATTACK/Lightning Touch\": \"指尖雷暴\",\n",
      "\"SKILL_Maguu Kenki_ELEMENTAL_BURST/Pseudo Tengu Sweeper\": \"机巧伪天狗抄\",\n",
      "\"SKILL_Maguu Kenki_ELEMENTAL_SKILL/Blustering Blade\": \"\"\n",
      "\"SKILL_Maguu Kenki_ELEMENTAL_SKILL/Frosty Assault\": \"\"\n",
      "\"SKILL_Maguu Kenki_NORMAL_ATTACK/Ichimonji\": \"一文字\",\n",
      "\"SKILL_Mirror Maiden_ELEMENTAL_BURST/Rippled Reflection\": \"粼镜折光\",\n",
      "\"SKILL_Mirror Maiden_ELEMENTAL_SKILL/Influx Blast\": \"潋波绽破\",\n",
      "\"SKILL_Mirror Maiden_NORMAL_ATTACK/Water Ball\": \"水弹\",\n",
      "\"SKILL_Mona_ELEMENTAL_BURST/Stellaris Phantasm\": \"星命定轨\",\n",
      "\"SKILL_Mona_ELEMENTAL_SKILL/Mirror Reflection of Doom\": \"水中幻愿\",\n",
      "\"SKILL_Mona_NORMAL_ATTACK/Ripple of Fate\": \"因果点破\",\n",
      "\"SKILL_Mona_PASSIVE/Illusory Torrent\": \"虚实流动\",\n",
      "\"SKILL_Nahida_ELEMENTAL_BURST/Illusory Heart\": \"心景幻成\",\n",
      "\"SKILL_Nahida_ELEMENTAL_SKILL/All Schemes to Know\": \"\"\n",
      "\"SKILL_Nahida_ELEMENTAL_SKILL/All Schemes to Know: Tathata\": \"\"\n",
      "\"SKILL_Nahida_NORMAL_ATTACK/Akara\": \"行相\",\n",
      "\"SKILL_Ningguang_ELEMENTAL_BURST/Starshatter\": \"天权崩玉\",\n",
      "\"SKILL_Ningguang_ELEMENTAL_SKILL/Jade Screen\": \"璇玑屏\",\n",
      "\"SKILL_Ningguang_NORMAL_ATTACK/Sparkling Scatter\": \"千金掷\",\n",
      "\"SKILL_Noelle_ELEMENTAL_BURST/Sweeping Time\": \"大扫除\",\n",
      "\"SKILL_Noelle_ELEMENTAL_SKILL/Breastplate\": \"护心铠\",\n",
      "\"SKILL_Noelle_NORMAL_ATTACK/Favonius Bladework - Maid\": \"西风剑术·女仆\",\n",
      "\"SKILL_Qiqi_ELEMENTAL_BURST/Adeptus Art: Preserver of Fortune\": \"仙法·救苦度厄\",\n",
      "\"SKILL_Qiqi_ELEMENTAL_SKILL/Adeptus Art: Herald of Frost\": \"仙法·寒病鬼差\",\n",
      "\"SKILL_Qiqi_NORMAL_ATTACK/Ancient Sword Art\": \"云来古剑法\",\n",
      "\"SKILL_Raiden Shogun_ELEMENTAL_BURST/Secret Art: Musou Shinsetsu\": \"奥义·梦想真说\",\n",
      "\"SKILL_Raiden Shogun_ELEMENTAL_SKILL/Transcendence: Baleful Omen\": \"神变·恶曜开眼\",\n",
      "\"SKILL_Raiden Shogun_NORMAL_ATTACK/Origin\": \"源流\",\n",
      "\"SKILL_Raiden Shogun_PASSIVE/Chakra Desiderata\": \"诸愿百眼之轮\",\n",
      "\"SKILL_Razor_ELEMENTAL_BURST/Lightning Fang\": \"雷牙\",\n",
      "\"SKILL_Razor_ELEMENTAL_SKILL/Claw and Thunder\": \"利爪与苍雷\",\n",
      "\"SKILL_Razor_NORMAL_ATTACK/Steel Fang\": \"钢脊\",\n",
      "\"SKILL_Rhodeia of Loch_ELEMENTAL_BURST/Tide and Torrent\": \"潮涌与激流\",\n",
      "\"SKILL_Rhodeia of Loch_ELEMENTAL_SKILL/Oceanid Mimic Summoning\": \"\"\n",
      "\"SKILL_Rhodeia of Loch_ELEMENTAL_SKILL/The Myriad Wilds\": \"\"\n",
      "\"SKILL_Rhodeia of Loch_NORMAL_ATTACK/Surge\": \"翻涌\",\n",
      "\"SKILL_Sangonomiya Kokomi_ELEMENTAL_BURST/Nereid's Ascension\": \"海人化羽\",\n",
      "\"SKILL_Sangonomiya Kokomi_ELEMENTAL_SKILL/Kurage's Oath\": \"海月之誓\",\n",
      "\"SKILL_Sangonomiya Kokomi_NORMAL_ATTACK/The Shape of Water\": \"水有常形\",\n",
      "\"SKILL_Shenhe_ELEMENTAL_BURST/Divine Maiden's Deliverance\": \"神女遣灵真诀\",\n",
      "\"SKILL_Shenhe_ELEMENTAL_SKILL/Spring Spirit Summoning\": \"仰灵威召将役咒\",\n",
      "\"SKILL_Shenhe_NORMAL_ATTACK/Dawnstar Piercer\": \"踏辰摄斗\",\n",
      "\"SKILL_Stonehide Lawachurl_ELEMENTAL_BURST/Upa Shato\": \"Upa Shato\",\n",
      "\"SKILL_Stonehide Lawachurl_ELEMENTAL_SKILL/Movo Lawa\": \"Movo Lawa\",\n",
      "\"SKILL_Stonehide Lawachurl_NORMAL_ATTACK/Plama Lawa\": \"Plama Lawa\",\n",
      "\"SKILL_Stonehide Lawachurl_PASSIVE/Infused Stonehide\": \"魔化：岩盔\",\n",
      "\"SKILL_Sucrose_ELEMENTAL_BURST/Forbidden Creation - Isomer 75 / Type II\": \"禁·风灵作成·柒伍同构贰型\",\n",
      "\"SKILL_Sucrose_ELEMENTAL_SKILL/Astable Anemohypostasis Creation - 6308\": \"风灵作成·陆叁零捌\",\n",
      "\"SKILL_Sucrose_NORMAL_ATTACK/Wind Spirit Creation\": \"简式风灵作成\",\n",
      "\"SKILL_Tartaglia_ELEMENTAL_BURST/Havoc: Obliteration\": \"极恶技·尽灭闪\",\n",
      "\"SKILL_Tartaglia_ELEMENTAL_SKILL/Foul Legacy: Raging Tide\": \"魔王武装·狂澜\",\n",
      "\"SKILL_Tartaglia_NORMAL_ATTACK/Cutting Torrent\": \"断雨\",\n",
      "\"SKILL_Tartaglia_PASSIVE/Tide Withholder\": \"遏浪\",\n",
      "\"SKILL_Tighnari_ELEMENTAL_BURST/Fashioner's Tanglevine Shaft\": \"造生缠藤箭\",\n",
      "\"SKILL_Tighnari_ELEMENTAL_SKILL/Vijnana-Phala Mine\": \"识果种雷\",\n",
      "\"SKILL_Tighnari_NORMAL_ATTACK/Khanda Barrier-Buster\": \"藏蕴破障\",\n",
      "\"SKILL_Venti_ELEMENTAL_BURST/Wind's Grand Ode\": \"风神之诗\",\n",
      "\"SKILL_Venti_ELEMENTAL_SKILL/Skyward Sonnet\": \"高天之歌\",\n",
      "\"SKILL_Venti_NORMAL_ATTACK/Divine Marksmanship\": \"神代射术\",\n",
      "\"SKILL_Wanderer_ELEMENTAL_BURST/Kyougen: Five Ceremonial Plays\": \"狂言·式乐五番\",\n",
      "\"SKILL_Wanderer_ELEMENTAL_SKILL/Hanega: Song of the Wind\": \"羽画·风姿华歌\",\n",
      "\"SKILL_Wanderer_NORMAL_ATTACK/Yuuban Meigen\": \"行幡鸣弦\",\n",
      "\"SKILL_Xiangling_ELEMENTAL_BURST/Pyronado\": \"旋火轮\",\n",
      "\"SKILL_Xiangling_ELEMENTAL_SKILL/Guoba Attack\": \"锅巴出击\",\n",
      "\"SKILL_Xiangling_NORMAL_ATTACK/Dough-Fu\": \"白案功夫\",\n",
      "\"SKILL_Xiao_ELEMENTAL_BURST/Bane of All Evil\": \"靖妖傩舞\",\n",
      "\"SKILL_Xiao_ELEMENTAL_SKILL/Lemniscatic Wind Cycling\": \"风轮两立\",\n",
      "\"SKILL_Xiao_NORMAL_ATTACK/Whirlwind Thrust\": \"卷积微尘\",\n",
      "\"SKILL_Xingqiu_ELEMENTAL_BURST/Raincutter\": \"裁雨留虹\",\n",
      "\"SKILL_Xingqiu_ELEMENTAL_SKILL/Fatal Rainscreen\": \"画雨笼山\",\n",
      "\"SKILL_Xingqiu_NORMAL_ATTACK/Guhua Style\": \"古华剑法\",\n",
      "\"SKILL_Yae Miko_ELEMENTAL_BURST/Great Secret Art: Tenko Kenshin\": \"大密法·天狐显真\",\n",
      "\"SKILL_Yae Miko_ELEMENTAL_SKILL/Yakan Evocation: Sesshou Sakura\": \"野干役咒·杀生樱\",\n",
      "\"SKILL_Yae Miko_NORMAL_ATTACK/Spiritfox Sin-Eater\": \"狐灵食罪式\",\n",
      "\"SKILL_Yanfei_ELEMENTAL_BURST/Done Deal\": \"凭此结契\",\n",
      "\"SKILL_Yanfei_ELEMENTAL_SKILL/Signed Edict\": \"丹书立约\",\n",
      "\"SKILL_Yanfei_NORMAL_ATTACK/Seal of Approval\": \"火漆制印\",\n",
      "\"SKILL_Yaoyao_ELEMENTAL_BURST/Moonjade Descent\": \"玉颗珊珊月中落\",\n",
      "\"SKILL_Yaoyao_ELEMENTAL_SKILL/Raphanus Sky Cluster\": \"云台团团降芦菔\",\n",
      "\"SKILL_Yaoyao_NORMAL_ATTACK/Toss 'N' Turn Spear\": \"颠扑连环枪\",\n",
      "\"SKILL_Yoimiya_ELEMENTAL_BURST/Ryuukin Saxifrage\": \"琉金云间草\",\n",
      "\"SKILL_Yoimiya_ELEMENTAL_SKILL/Niwabi Fire-Dance\": \"焰硝庭火舞\",\n",
      "\"SKILL_Yoimiya_NORMAL_ATTACK/Firework Flare-Up\": \"烟火打扬\",\n",
      "\"SKILL_Zhongli_ELEMENTAL_BURST/Planet Befall\": \"天星\",\n",
      "\"SKILL_Zhongli_ELEMENTAL_SKILL/Dominus Lapidis\": \"\"\n",
      "\"SKILL_Zhongli_ELEMENTAL_SKILL/Dominus Lapidis: Striking Stone\": \"\"\n",
      "\"SKILL_Zhongli_NORMAL_ATTACK/Rain of Stone\": \"岩雨\",\n"
     ]
    }
   ],
   "source": [
    "# fill skills\n",
    "type_dict = {\n",
    "    'ELEMENTAL_SKILL': '元素战技',\n",
    "    'ELEMENTAL_BURST': '元素爆发',\n",
    "    'NORMAL_ATTACK': '普通攻击',\n",
    "    'PASSIVE': '被动技能'\n",
    "}\n",
    "import json\n",
    "data = json.load(open('eng_names.json'))\n",
    "chn_data = json.load(open('chn_char.json'))\n",
    "for key in data.keys():\n",
    "    if 'SKILL_' in key:\n",
    "        if 'Mob' in key:\n",
    "            continue\n",
    "        char_name = key.split('/')[0].split('_')[1]\n",
    "        skill_type = '_'.join(key.split('/')[0].split('_')[2:])\n",
    "        real_name = key.split('/')[-1]\n",
    "        char_chn_name = data[f'CHARACTER/{char_name}']\n",
    "        skill_lists = chn_data[char_chn_name]\n",
    "        found = []\n",
    "        for skill in skill_lists:\n",
    "            if skill[1] == type_dict[skill_type]:\n",
    "                # assert len(found) == 0, (found, skill)\n",
    "                found.append(skill)\n",
    "        if len(found) != 1:\n",
    "            print(f'\"{key}\": \"\"')\n",
    "            continue\n",
    "        else:\n",
    "            found = found[0]\n",
    "\n",
    "        # print(f'{key} {char_name} {chn_name}')\n",
    "        print(f'\"{key}\": \"{found[0]}\",')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# mob skill names\n",
    "mob_string = '''\"SKILL_XXXMobMage_ELEMENTAL_BURST/XXX Elemental Burst\": \"YYY元素爆发\",\n",
    "\"SKILL_XXXMobMage_ELEMENTAL_SKILL/XXX Elemental Skill\": \"YYY元素战技\",\n",
    "\"SKILL_XXXMobMage_NORMAL_ATTACK/XXX Normal Attack\": \"YYY普通攻击\",\n",
    "\"SKILL_XXXMob_ELEMENTAL_BURST/XXX Elemental Burst\": \"YYY元素爆发\",\n",
    "\"SKILL_XXXMob_ELEMENTAL_SKILL/XXX Elemental Skill\": \"YYY元素战技\",\n",
    "\"SKILL_XXXMob_NORMAL_ATTACK/Physical Normal Attack\": \"物理普通攻击\",'''\n",
    "elements = {\n",
    "    'Anemo': '风',\n",
    "    'Cryo': '冰',\n",
    "    'Dendro': '草',\n",
    "    'Electro': '雷',\n",
    "    'Geo': '岩',\n",
    "    'Hydro': '水',\n",
    "    'Pyro': '火'\n",
    "}\n",
    "for eng, chn in elements.items():\n",
    "    parsed = mob_string.replace('XXX', eng).replace('YYY', chn)\n",
    "    print(parsed)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "multiple name found and desc different, keep version 4.1 绝缘之旗印 ARTIFACT/Emblem of Severed Fate ['ARTIFACT/Emblem of Severed Fate/3.7', 'ARTIFACT/Emblem of Severed Fate/4.0', 'ARTIFACT/Emblem of Severed Fate/4.1']\n",
      "multiple name found and desc different, keep version 4.1 神宝迁宫祝词 CARD/Blessing of the Divine Relic's Installation [\"CARD/Blessing of the Divine Relic's Installation/3.3\", \"CARD/Blessing of the Divine Relic's Installation/4.1\"]\n",
      "multiple name found and desc different, keep version 4.0 本大爷还没有输！ CARD/I Haven't Lost Yet! [\"CARD/I Haven't Lost Yet!/3.3\", \"CARD/I Haven't Lost Yet!/4.0\"]\n",
      "multiple name found and desc different, keep version 4.1 诸武精通 CARD/Master of Weaponry ['CARD/Master of Weaponry/3.3', 'CARD/Master of Weaponry/4.1']\n",
      "multiple name found and desc different, keep version 3.4 兽肉薄荷卷 CARD/Minty Meat Rolls ['CARD/Minty Meat Rolls/3.3', 'CARD/Minty Meat Rolls/3.4']\n",
      "multiple name found and desc different, keep version 3.7 送你一程 CARD/Send Off ['CARD/Send Off/3.3', 'CARD/Send Off/3.7']\n",
      "multiple name found and desc different, keep version 4.0 雷与永恒 CARD/Thunder and Eternity ['CARD/Thunder and Eternity/3.7', 'CARD/Thunder and Eternity/4.0']\n",
      " extra name not found, but found same name in CARD CHARACTER_STATUS/Adeptus' Temptation 仙跳墙\n",
      " extra name not found, but found same name in CARD CHARACTER_STATUS/Butter Crab 黄油蟹蟹\n",
      " extra name not found, but found same name in CARD CHARACTER_STATUS/Elemental Resonance: Fervent Flames 元素共鸣：热诚之火\n",
      " extra name not found, but found same name in CARD CHARACTER_STATUS/Elemental Resonance: Shattering Ice 元素共鸣：粉碎之冰\n",
      "extra name not found CHARACTER_STATUS/Frozen 冻结\n",
      "multiple name found and desc different, keep version 3.8 冷酷之心 CHARACTER_STATUS/Grimheart ['CHARACTER_STATUS/Grimheart/3.5', 'CHARACTER_STATUS/Grimheart/3.8']\n",
      " extra name not found, but found same name in CARD CHARACTER_STATUS/Heavy Strike 重攻击\n",
      " extra name not found, but found same name in CARD CHARACTER_STATUS/Jueyun Guoba 绝云锅巴\n",
      " extra name not found, but found same name in WEAPON CHARACTER_STATUS/King's Squire 王下近侍\n",
      " extra name not found, but found same name in WEAPON CHARACTER_STATUS/Lithic Spear 千岩长枪\n",
      " extra name not found, but found same name in CARD CHARACTER_STATUS/Lotus Flower Crisp 莲花酥\n",
      "extra name not found CHARACTER_STATUS/Midare Ranzan: Cryo 乱岚拨止·冰\n",
      "extra name not found CHARACTER_STATUS/Midare Ranzan: Electro 乱岚拨止·雷\n",
      "extra name not found CHARACTER_STATUS/Midare Ranzan: Hydro 乱岚拨止·水\n",
      "extra name not found CHARACTER_STATUS/Midare Ranzan: New 乱岚拨止·新\n",
      "extra name not found CHARACTER_STATUS/Midare Ranzan: Pyro 乱岚拨止·火\n",
      "multiple name found and desc different, keep version 3.4 兽肉薄荷卷 CHARACTER_STATUS/Minty Meat Rolls ['CHARACTER_STATUS/Minty Meat Rolls/3.3', 'CHARACTER_STATUS/Minty Meat Rolls/3.4']\n",
      " extra name not found, but found same name in CARD CHARACTER_STATUS/Minty Meat Rolls 兽肉薄荷卷\n",
      " extra name not found, but found same name in WEAPON CHARACTER_STATUS/Moonpiercer 贯月矢\n",
      " extra name not found, but found same name in CARD CHARACTER_STATUS/Mushroom Pizza 烤蘑菇披萨\n",
      " extra name not found, but found same name in CARD CHARACTER_STATUS/Northern Smoked Chicken 北地烟熏鸡\n",
      " extra name not found, but found same name in CARD CHARACTER_STATUS/Sashimi Platter 刺身拼盘\n",
      "extra name not found CHARACTER_STATUS/Satiated 饱腹\n",
      " extra name not found, but found same name in CARD CHARACTER_STATUS/Tandoori Roast Chicken 唐杜尔烤鸡\n",
      "extra name not found CHARACTER_STATUS/The Shrine's Sacred Shade 神篱之御荫\n",
      " extra name not found, but found same name in ARTIFACT CHARACTER_STATUS/Vermillion Hereafter 辰砂往生录\n",
      "multiple name found and desc different, keep version 3.8 斫雷 SKILL_Beidou_ELEMENTAL_BURST/Stormbreaker ['SKILL_Beidou_ELEMENTAL_BURST/Stormbreaker/3.4', 'SKILL_Beidou_ELEMENTAL_BURST/Stormbreaker/3.8']\n",
      "multiple name found and desc different, keep version 3.8 踏潮 SKILL_Beidou_ELEMENTAL_SKILL/Wavestrider ['SKILL_Beidou_ELEMENTAL_SKILL/Wavestrider/3.4', 'SKILL_Beidou_ELEMENTAL_SKILL/Wavestrider/3.8']\n",
      "skill name not found SKILL_Beidou_ELEMENTAL_SKILL/Wavestrider 踏潮\n",
      "skill name not found SKILL_Candace_ELEMENTAL_SKILL/Heron Strike 苍鹭震击\n",
      "skill name not found SKILL_Dehya_ELEMENTAL_BURST/Incineration Drive 焚落踢\n",
      "skill name not found SKILL_Electro Hypostasis_ELEMENTAL_SKILL/Rock-Paper-Scissors Combo: Paper 猜拳三连击·布\n",
      "skill name not found SKILL_Electro Hypostasis_ELEMENTAL_SKILL/Rock-Paper-Scissors Combo: Scissors 猜拳三连击·剪刀\n",
      "multiple name found and desc different, keep version 3.7 降众天华 SKILL_Ganyu_ELEMENTAL_BURST/Celestial Shower ['SKILL_Ganyu_ELEMENTAL_BURST/Celestial Shower/3.3', 'SKILL_Ganyu_ELEMENTAL_BURST/Celestial Shower/3.7']\n",
      "multiple name found and desc different, keep version 4.1 神里流·水囿 SKILL_Kamisato Ayato_ELEMENTAL_BURST/Kamisato Art: Suiyuu ['SKILL_Kamisato Ayato_ELEMENTAL_BURST/Kamisato Art: Suiyuu/3.6', 'SKILL_Kamisato Ayato_ELEMENTAL_BURST/Kamisato Art: Suiyuu/4.1']\n",
      "multiple name found and desc different, keep version 3.4 孤风刀势 SKILL_Maguu Kenki_ELEMENTAL_SKILL/Blustering Blade ['SKILL_Maguu Kenki_ELEMENTAL_SKILL/Blustering Blade/3.3', 'SKILL_Maguu Kenki_ELEMENTAL_SKILL/Blustering Blade/3.4']\n",
      "multiple name found and desc different, keep version 3.4 霜驰影突 SKILL_Maguu Kenki_ELEMENTAL_SKILL/Frosty Assault ['SKILL_Maguu Kenki_ELEMENTAL_SKILL/Frosty Assault/3.3', 'SKILL_Maguu Kenki_ELEMENTAL_SKILL/Frosty Assault/3.4']\n",
      "multiple name found and desc different, keep version 3.8 雷牙 SKILL_Razor_ELEMENTAL_BURST/Lightning Fang ['SKILL_Razor_ELEMENTAL_BURST/Lightning Fang/3.3', 'SKILL_Razor_ELEMENTAL_BURST/Lightning Fang/3.8']\n",
      "multiple name found and desc different, keep version 3.6 海人化羽 SKILL_Sangonomiya Kokomi_ELEMENTAL_BURST/Nereid's Ascension [\"SKILL_Sangonomiya Kokomi_ELEMENTAL_BURST/Nereid's Ascension/3.5\", \"SKILL_Sangonomiya Kokomi_ELEMENTAL_BURST/Nereid's Ascension/3.6\"]\n",
      "multiple name found and desc different, keep version 4.1 极恶技·尽灭闪 SKILL_Tartaglia_ELEMENTAL_BURST/Havoc: Obliteration ['SKILL_Tartaglia_ELEMENTAL_BURST/Havoc: Obliteration/3.7', 'SKILL_Tartaglia_ELEMENTAL_BURST/Havoc: Obliteration/4.1']\n",
      "multiple name found and desc different, keep version 4.1 魔王武装·狂澜 SKILL_Tartaglia_ELEMENTAL_SKILL/Foul Legacy: Raging Tide ['SKILL_Tartaglia_ELEMENTAL_SKILL/Foul Legacy: Raging Tide/3.7', 'SKILL_Tartaglia_ELEMENTAL_SKILL/Foul Legacy: Raging Tide/4.1']\n",
      "multiple name found and desc different, keep version 3.8 旋火轮 SKILL_Xiangling_ELEMENTAL_BURST/Pyronado ['SKILL_Xiangling_ELEMENTAL_BURST/Pyronado/3.3', 'SKILL_Xiangling_ELEMENTAL_BURST/Pyronado/3.8']\n",
      "multiple name found and desc different, keep version 4.1 裁雨留虹 SKILL_Xingqiu_ELEMENTAL_BURST/Raincutter ['SKILL_Xingqiu_ELEMENTAL_BURST/Raincutter/3.3', 'SKILL_Xingqiu_ELEMENTAL_BURST/Raincutter/3.6', 'SKILL_Xingqiu_ELEMENTAL_BURST/Raincutter/4.1']\n",
      "multiple name found and desc different, keep version 3.8 琉金云间草 SKILL_Yoimiya_ELEMENTAL_BURST/Ryuukin Saxifrage ['SKILL_Yoimiya_ELEMENTAL_BURST/Ryuukin Saxifrage/3.3', 'SKILL_Yoimiya_ELEMENTAL_BURST/Ryuukin Saxifrage/3.4', 'SKILL_Yoimiya_ELEMENTAL_BURST/Ryuukin Saxifrage/3.8']\n",
      "multiple name found and desc different, keep version 4.1 冰萤 SUMMON/Cryo Cicins ['SUMMON/Cryo Cicins/3.7', 'SUMMON/Cryo Cicins/4.1']\n",
      "multiple name found and desc different, keep version 3.8 光降之剑 SUMMON/Lightfall Sword ['SUMMON/Lightfall Sword/3.5', 'SUMMON/Lightfall Sword/3.8']\n",
      "multiple name found and desc different, keep version 4.1 卯师傅 SUPPORT/Chef Mao ['SUPPORT/Chef Mao/3.3', 'SUPPORT/Chef Mao/4.1']\n",
      "multiple name found and desc different, keep version 4.1 迪娜泽黛 SUPPORT/Dunyarzad ['SUPPORT/Dunyarzad/3.7', 'SUPPORT/Dunyarzad/4.1']\n",
      "multiple name found and desc different, keep version 3.7 唯此一心 TALENT_Ganyu/Undivided Heart ['TALENT_Ganyu/Undivided Heart/3.3', 'TALENT_Ganyu/Undivided Heart/3.7']\n",
      "card name not found TALENT_Keqing/Lightning Stiletto 雷楔\n",
      " extra name not found, but found same name in ARCANE TEAM_STATUS/Ancient Courtyard 旧时庭园\n",
      " extra name not found, but found same name in CARD TEAM_STATUS/Changing Shifts 换班时间\n",
      "extra name not found TEAM_STATUS/Crystallize 结晶\n",
      " extra name not found, but found same name in CARD TEAM_STATUS/Elemental Resonance: Enduring Rock 元素共鸣：坚定之岩\n",
      " extra name not found, but found same name in CARD TEAM_STATUS/Elemental Resonance: Sprawling Greenery 元素共鸣：蔓生之草\n",
      "extra name not found TEAM_STATUS/Floral Sidewinder 飞叶迴斜\n",
      " extra name not found, but found same name in ARCANE TEAM_STATUS/Fresh Wind of Freedom 自由的新风\n",
      " extra name not found, but found same name in CARD TEAM_STATUS/I Haven't Lost Yet! 本大爷还没有输！\n",
      " extra name not found, but found same name in CARD TEAM_STATUS/Leave It to Me! 交给我吧！\n",
      " extra name not found, but found same name in CARD TEAM_STATUS/Pankration! 拳力斗技！\n",
      "extra name not found TEAM_STATUS/Poetics of Fuubutsu: Cryo 风物之诗咏·冰\n",
      "extra name not found TEAM_STATUS/Poetics of Fuubutsu: Electro 风物之诗咏·雷\n",
      "extra name not found TEAM_STATUS/Poetics of Fuubutsu: Hydro 风物之诗咏·水\n",
      "extra name not found TEAM_STATUS/Poetics of Fuubutsu: Pyro 风物之诗咏·火\n",
      "extra name not found TEAM_STATUS/Rebellious Shield 叛逆的守护\n",
      "extra name not found TEAM_STATUS/Revive on cooldown 复活冷却中\n",
      " extra name not found, but found same name in CARD TEAM_STATUS/Rhythm of the Great Dream 大梦的曲调\n",
      "extra name not found TEAM_STATUS/Shrine of Maya 摩耶之殿\n",
      " extra name not found, but found same name in CARD TEAM_STATUS/Stone and Contracts 岩与契约\n",
      " extra name not found, but found same name in CARD TEAM_STATUS/When the Crane Returned 鹤归之时\n",
      " extra name not found, but found same name in CARD TEAM_STATUS/Where Is the Unseen Razor? 藏锋何处\n",
      "multiple name found and desc different, keep version 4.1 风与自由 TEAM_STATUS/Wind and Freedom ['TEAM_STATUS/Wind and Freedom/3.7', 'TEAM_STATUS/Wind and Freedom/4.1']\n",
      " extra name not found, but found same name in CARD TEAM_STATUS/Wind and Freedom 风与自由\n",
      "extra name not found TEAM_STATUS/Winds of Harmony 绪风之拥\n",
      "multiple name found and desc different, keep version 3.7 千岩长枪 WEAPON/Lithic Spear ['WEAPON/Lithic Spear/3.3', 'WEAPON/Lithic Spear/3.7']\n"
     ]
    }
   ],
   "source": [
    "# names to descs\n",
    "import json\n",
    "name_data = json.load(open('eng_names.json'))\n",
    "desc_data = json.load(open('eng_descs.json'))\n",
    "desc_keys = list(desc_data.keys())\n",
    "chn_card = json.load(open('chn_card.json'))\n",
    "chn_char = json.load(open('chn_char.json'))\n",
    "chn_extra = json.load(open('chn_extra.json'))\n",
    "items = list(name_data.items())\n",
    "items.sort()\n",
    "result = {}\n",
    "for key in desc_data.keys():\n",
    "    result[key] = ''\n",
    "# print_sys = print\n",
    "# def print(str):\n",
    "#     key, value = str.split('\": \"')\n",
    "#     key = key[1:].replace('\"', r'\\\"').replace('\\n', r'\\n')\n",
    "#     value = value[:-2].replace('\"', r'\\\"').replace('\\n', r'\\n')\n",
    "#     print_sys(f'\"{key}\": \"{value}\",')\n",
    "\n",
    "def set_value(d, ks, v):\n",
    "    if not isinstance(ks, list | tuple):\n",
    "        ks = [ks]\n",
    "    for k in ks:\n",
    "        d[k] = v\n",
    "\n",
    "for name, chn_name in items:\n",
    "    real_name = name.split('/')[-1]\n",
    "    main_type = name.split('/')[0].split('_')[0]\n",
    "    if '_STATUS' in name:\n",
    "        main_type = '_'.join(name.split('/')[0].split('_')[:2])\n",
    "    desc_names = [x for x in desc_keys if f'{name}/' in x]\n",
    "    if len(desc_names) == 0:\n",
    "        # not found, maybe can find same name card or weapon or artifact\n",
    "        print('no name found', chn_name, name)\n",
    "        continue\n",
    "    elif len(desc_names) != 1:\n",
    "        descs = [desc_data[x] for x in desc_names]\n",
    "        if len(set(descs)) != 1:\n",
    "            # desc not all same, keep latest version\n",
    "            latest = max(desc_names)  # keep latest version\n",
    "            version = latest.split('/')[-1]\n",
    "            print(f'multiple name found and desc different, keep version '\n",
    "                  f'{version}', chn_name, name, desc_names)\n",
    "            desc_names = [latest]\n",
    "    else:\n",
    "        pass\n",
    "    card_types = ['ARCANE', 'CARD', 'ARTIFACT', 'WEAPON', 'SUPPORT', 'TALENT']\n",
    "    if main_type in card_types:\n",
    "        # is a card\n",
    "        if chn_name not in chn_card:\n",
    "            # print(f'\"{desc_name}\": \"\",')\n",
    "            print('card name not found', name, chn_name)\n",
    "            continue\n",
    "        # print(f'\"{desc_name}\": \"{chn_card[chn_name]}\",')\n",
    "        set_value(result, desc_names, chn_card[chn_name])\n",
    "    elif main_type in ['CHARACTER_STATUS', 'TEAM_STATUS', 'SUMMON']:\n",
    "        # is extra\n",
    "        chn_type = {\n",
    "            'CHARACTER_STATUS': '状态',\n",
    "            'TEAM_STATUS': '出战状态',\n",
    "            'SUMMON': '召唤物'\n",
    "        }[main_type]\n",
    "        target_dict = chn_extra[chn_type]\n",
    "        if chn_name not in target_dict:\n",
    "            # check if has same name card, weapon and artifact\n",
    "            for tg in card_types:\n",
    "                tg_name = f'{tg}/{real_name}'\n",
    "                if tg_name in name_data:\n",
    "                    assert name_data[tg_name] == chn_name\n",
    "                    print(' extra name not found, but found same name in '\n",
    "                          f'{tg}', name, chn_name)\n",
    "                    set_value(result, desc_names, chn_card[chn_name])\n",
    "                    break\n",
    "            else:\n",
    "                print('extra name not found', name, chn_name)\n",
    "            continue\n",
    "        # print(f'\"{desc_name}\": \"{target_dict[chn_name]}\",')\n",
    "        set_value(result, desc_names, target_dict[chn_name])\n",
    "    elif main_type == 'CHARACTER':\n",
    "        # is character, skip desc\n",
    "        # print(f'\"{desc_name}\": \"\",')\n",
    "        ...\n",
    "    elif main_type == 'SKILL':\n",
    "        # is skill\n",
    "        character_name = name.split('/')[0].split('_')[1]\n",
    "        chn_character_name = name_data[f'CHARACTER/{character_name}']\n",
    "        if '元素法师' in chn_character_name or '元素路人' in chn_character_name:\n",
    "            chn_character_name = chn_character_name[-4:]\n",
    "            skills = chn_char[chn_character_name]\n",
    "            for sname, stype, sdesc in skills:\n",
    "                if sname[-4:] == chn_name[-4:]:\n",
    "                    set_value(result, desc_names, sdesc.replace('X', chn_name[0]))\n",
    "                    # print(desc_data[desc_name], chn_name, sname, stype, sdesc)\n",
    "                    break\n",
    "            continue\n",
    "        if chn_character_name not in chn_char:\n",
    "            # print(f'\"{desc_name}\": \"\",')\n",
    "            print('character name not found', name, chn_character_name)\n",
    "            continue\n",
    "        skills = chn_char[chn_character_name]\n",
    "        for sname, stype, sdesc in skills:\n",
    "            if sname == chn_name:\n",
    "                # print(f'\"{desc_name}\": \"{sdesc}\",')\n",
    "                set_value(result, desc_names, sdesc)\n",
    "                break\n",
    "        else:\n",
    "            # print(f'\"{desc_name}\": \"\",')\n",
    "            print('skill name not found', name, chn_name)\n",
    "    elif main_type == 'EMPTY':\n",
    "        # system handlers, skip desc\n",
    "        # print(f'\"{desc_name}\": \"\",')\n",
    "        ...\n",
    "    else:\n",
    "        raise NotImplementedError(main_type)\n",
    "json.dump(result, open('chn_descs.json', 'w', encoding='utf-8'), \n",
    "          indent = 2, ensure_ascii = False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# engname to parse names, save to en/names.json\n",
    "\n",
    "source = 'eng_names.json'\n",
    "target = 'en/names.json'\n",
    "import json\n",
    "data = json.load(open(source))\n",
    "for key in data.keys():\n",
    "    data[key] = key.split('/')[-1]\n",
    "json.dump(data, open(target, 'w', encoding='utf-8'), \n",
    "          indent = 2, ensure_ascii = False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "GITCG",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
